package com.xingkeduo.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author chi  2019-05-21 21:22
 **/
@Configuration
public class MqConfig {

    @Bean
    public Queue websocket_queue() {
        return new Queue("websocket_transfer_queue", true, false, false);
    }


    @Bean
    public DirectExchange websocket_exchange() {
        return new DirectExchange("websocket_transfer_exchange", true, false);
    }

    @Bean
    public Binding websocket_bind() {
        return BindingBuilder.bind(this.websocket_queue()).to(this.websocket_exchange()).with("websocket_transfer_key");
    }

}
